#!/bin/sh
if [ ! -e /aria2/down/aria2.session ]; then 
	touch /aria2/down/aria2.session
	echo "create file:aria2.session"
else
	echo "using exits aria2.session"
fi

if [ ! -e /aria2/down/aria2.log ]; then 
	touch /aria2/down/aria2.log
	echo "create file:aria2.log"
else
	echo "using exits aria2.log"
fi

if [ ! -e /aria2/down/aria2.conf ]; then 
	cp /aria2/conf/aria2.conf /aria2/down/aria2.conf
	echo "your rpc secert is:${ARIA2C_RPC_SECRET}"
	echo "rpc-secret=${ARIA2C_RPC_SECRET}" >>/aria2/down/aria2.conf
	echo "using default aria2.conf"
else
	echo "using exits aria2.conf"
fi

echo "start aria2c on port 6800..."
aria2c --conf-path /aria2/down/aria2.conf -D
node /yaaw/node-server.js 8080
